<%DIRECTIVE DYNAMIC;%>
<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-label="Close">
		<span aria-hidden="true">&times;</span>
	</button>
	<h5 class="modal-title" >修改</h5>
</div>
<form id="eidtForm" role="form" class="form-horizontal parsley-form" data-parsley-validate action="${base}/platform/call/editDo" method="post">
	<div class="modal-body ">
		<input type="hidden" name="id" value="${obj.call.id!}"> 
		<input type="hidden" name="createAt" value="${obj.call.createAt!}"> 
		<input type="hidden" name="createBy" value="${obj.call.createBy!}">
		<div class="row mb10">
			<div class="col-lg-12">
			<div class="col-lg-8">
				<div class="form-group">
					<label for="name" class="col-sm-2 control-label">姓名</label>
					<div class="col-sm-3">
						<input type="text" id="name" class="form-control" name="name" required="required" placeholder="名称" value="${obj.call.name!}">
					</div>
					
					<label for="mobile" class="col-sm-2 control-label">电话</label>
					<div class="col-sm-3">
						<input type="text" id="mobile" class="form-control" name="mobile" placeholder="电话" value="${obj.call.mobile!}">
					</div>
				</div>
				<div class="form-group">
                    <label for="train_type" class="col-sm-2 control-label">学车类型</label>
					<div class="col-sm-3" >
						<select id="train_type" name="train_type" class="form-control">
                      		<option value="1" <% if(obj.call.train_type==1){ %> selected="selected" <% } %> >报考 C1</option>
                      		<option value="2" <% if(obj.call.train_type==2){ %> selected="selected" <% } %>>报考 C2</option>
                      		<option value="3" <% if(obj.call.train_type==3){ %> selected="selected" <% } %>>培训 C1</option>
                      		<option value="4" <% if(obj.call.train_type==4){ %> selected="selected" <% } %>>培训 C2</option>
                      		<option value="5" <% if(obj.call.train_type==5){ %> selected="selected" <% } %>>VIP</option>
                      		<option value="6" <% if(obj.call.train_type==6){ %> selected="selected" <% } %>>科目二 C1</option>
                      		<option value="7" <% if(obj.call.train_type==7){ %> selected="selected" <% } %>>科目二 C2</option>
                      		<option value="8" <% if(obj.call.train_type==8){ %> selected="selected" <% } %>>科目三 C1</option>
                      		<option value="9" <% if(obj.call.train_type==9){ %> selected="selected" <% } %>>科目三 C2</option>
                       	</select>
                    </div>
                    <label for="source" class="col-sm-2 control-label">来源</label>
					<div class="col-sm-3" >
						<select id="source" name="source" class="form-control">
                      		<option value="1" <% if(obj.call.source==1){ %> selected="selected" <% } %>>百度</option>
                      		<option value="2" <% if(obj.call.source==2){ %> selected="selected" <% } %>>58</option>
                      		<option value="3" <% if(obj.call.source==3){ %> selected="selected" <% } %>>朋友介绍</option>
                      		<option value="9" <% if(obj.call.source==9){ %> selected="selected" <% } %>>其他</option>
                       	</select>
                    </div>
				</div>
				<div class="form-group">
					<label for="address" class="col-sm-2 control-label">意向地址</label>
					<div class="col-sm-8">
						<input type="text" id="address" class="form-control" name="address" required="required" placeholder="意向地址" value="${obj.call.address}">
					</div>
				</div>
				<div class="form-group">
					<label for="sex" class="col-sm-2 control-label">性别</label>
					<div class="col-sm-3" >
						<input type="radio" name="sex" value="1" required="required" <% if(obj.call.sex==1){ %> checked="checked" <% } %>> 男
						<input type="radio" name="sex" value="0" required="required" <% if(obj.call.sex==0){ %> checked="checked" <% } %>> 女
                    </div>
				</div>
				<div class="form-group">
					<label for="state" class="col-sm-2 control-label">状态</label>

					<div class="col-sm-8">
						<input type="radio" name="state" required="required" value="0" <% if(obj.call.state==0){ %> checked="checked" <% } %>/>咨询客户
						<input type="radio" name="state" required="required" value="1" <% if(obj.call.state==1){ %> checked="checked" <% } %>/>意向客户
						<input type="radio" name="state" required="required" value="2" <% if(obj.call.state==2){ %> checked="checked" <% } %>/>终止客户
					</div>
				</div>
				<div class="form-group">
					<label for="memo" class="col-sm-2 control-label">备注</label>

					<div class="col-sm-8">
						<textarea rows="5" cols="5" id="remark" class="form-control" name="remark" required="required" data-parsley-maxlength="5000" placeholder="备注">${obj.call.remark!}</textarea>
					</div>
				</div>
				<div class="form-group">
                 	<label for="createAt" class="col-sm-2 control-label">访问时间</label>
               		<div class="col-sm-8">
	               		<input type="text" class="form-control" id="createAt" name="createAtStr"  value="${@date.getDate(obj.call.createAt)}" />
	              	</div>
             	</div>
			</div>
			<div class="col-lg-4">
					<div class="row">
				        <table class="table table-bordered table-hover mg-t datatable">
				            <thead>
				            <tr>
								<th>备注</th>
								<th>时间</th>
							</tr>
							<%for(record in obj.records){%>
								<tr>
									<td>
										${record.remark!}
				             		</td>
				             		<td>
				             			${@date.getDate(record.createAt)}
				             		</td>
				             	</tr>
	             			<%}%>
				        </table>
	    			</div>
			</div>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button  class="btn btn-default btn-sm btn-parsley"  >完成</button> 
	</div>
</form>
<script language="JavaScript">
    $(document).ready(function () {
     	$.datetimepicker.setLocale('ch');
	   	$('#createAt').datetimepicker({
        	lang:'ch',
           	format:'Y-m-d H:i:s'
       	});
    	var dialog=$("#editModal");
		$("#editModalDialog").draggable();
        $('#eidtForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    datatable.ajax.reload();
	               	dialog.modal("hide");
                } else {
                    Toast.error(data.msg);
                    datatable.ajax.reload();
                 	dialog.modal("hide");
                }
            }
        });
    });
</script>
